<template>
  <div class="index_service">
    <div class="prev-arrow" @click="handlePrev" >
      <i class="fa fa-angle-left" :style="{color:app_tabBar.config.secondcolor}"></i>
    </div>
    <swiper class="list" :show-dots="false" v-model="swiperIndex" ref="swiper">
      <swiper-item class="slide-item" v-for="item in data.list" :key="item.id">
        <div class="body">
          <figure>
            <img :src="item.columnimg" class="slide-image " ref="service_img" />
          </figure>
          <div class="content">
            <div class="title" :style="{color:app_tabBar.config.firstcolor}">{{item.name}}</div>
            <p :style="{color:app_tabBar.config.secondcolor}">{{item.description}}</p>
          </div>
        </div>
      </swiper-item>
    </swiper>
    <div class="next-arrow" @click="handleNext" >
      <i class="fa fa-angle-right" :style="{color:app_tabBar.config.secondcolor}"></i>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
  components: {},
  props: {
    data: Object
  },
  computed: {
    ...mapGetters(['app_tabBar'])
  },
  mounted() {
    const img = this.$refs.service_img[0]
    img.onload = () => {
      this.$refs.swiper.xheight = img.height + 106 + 'px'
    }
  },
  data() {
    return {
      swiperIndex: 0
    }
  },
  methods: {
    handlePrev() {
      this.swiperIndex--
    },
    handleNext() {
      this.swiperIndex++
    }
  }
}
</script>
<style lang="scss" scoped>
.index_service {
  position: relative;
  .fa {
    font-size: 40px;
    color: #a6a6a6;
    opacity: 0.5s;
  }
  .prev-arrow {
    position: absolute;
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
  }
  .next-arrow {
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
  }
  .list {
    margin: 0 25px;
  }
  .slide-item {
    .content {
      text-align: left;
      .title {
        overflow: hidden;
        text-shadow: none;
        font-size: 16px;
        height: 46px;
        line-height: 46px;
        color: #000000;
        transition: all 0.66s cubic-bezier(0.17, 0.84, 0.44, 1);
        border-bottom: 1px solid #e1e1e1;
        text-align: left;
        width: 100%;
        position: relative;
        &:before {
          position: absolute;
          content: '';
          width: 10px;
          height: 1px;
          background-color: #000000;
          background-color: #000000;
          bottom: 0;
          -webkit-transition: all 0.66s cubic-bezier(0.17, 0.84, 0.44, 1);
          transition: all 0.66s cubic-bezier(0.17, 0.84, 0.44, 1);
        }
      }
      p {
        color: #999999;
        font-size: 13px;
        line-height: 24px;
        height: 50px;
        overflow: hidden;
        width: 100%;
        margin-top: 10px;
        margin-bottom: 14px;
      }
    }
  }
}
</style>